Guild icon
Project Sekai
🔒 GDG Algiers CTF 2022 / ✅-reverse-mazinrev
Avatar
MazinRev - 500 points
Category: Reverse Description: > "You must take your opponent into a deep dark forest where 2+2=5".
- Mikhail Tal
The challenge was made based on "Tal" mindset, escape from that forest. Author : 0xc001 Files:Tags: No tags.
Sutx pinned a message to this channel. 10/07/2022 11:01 AM
Avatar
@TheBadGod wants to collaborate 🤝
Avatar
start at 5, goal is at 6, need to figure out how to encode the sol ##############6 ##############2 ########2322#22 2322####2##222# 2##222##3####4# 3####3##224#### 224##2###2##### #2##422#22##### #5####222###### ########4######
Avatar
void __fastcall go_through(idk *a1) { while ( (a1->current_tile == 2 || a1->current_tile == 3 || a1->current_tile == 4) && a1->char_index <= 7u ) { a1->current_tile = check_move(a1); ++a1->char_index; } } mh, but we need to do it in 8 or less steps.... (char_index <= 7)
12:11
initially facing up on 5 ] => rotate left on 3s [ => rotate left on 2s \ => rotate left on 4s Y => rotate left U => rotate right on 3s S => rotate right on 2s R => rotate right on 4s Q => rotate right M => move on 3s K => move on 2s J => move on 4s I => move GOAL on 6
Avatar
rotate + move are 2 steps? and whats the second thing
Avatar
the second thing?
Avatar
the on xs?
12:14
that's the tile numbers
Avatar
Avatar
TheBadGod
start at 5, goal is at 6, need to figure out how to encode the sol ##############6 ##############2 ########2322#22 2322####2##222# 2##222##3####4# 3####3##224#### 224##2###2##### #2##422#22##### #5####222###### ########4######
see here
12:15
so U only works on tiles with 3 on them
Avatar
doesnt seem likely in 8 steps, or i understand wrong, e.g. you need IKK to move up before turn left
Avatar
yeah, thought about some exploits (namely the 2 on the very far is very sus, because in the 1d array, the field just to the left is also walkable, but 2 beneath the goal)
12:17
but they seem to check that x!=0 when going left
Avatar
oh i see, ill read code a bit
Avatar
decompilation as far as i have it (main thing is go_through afaict)
Avatar
OOOOH
12:32
the char index is reset when we use another char
12:32
so we need to make an algo which can solve the maze in 8 chars
Avatar
Avatar
TheBadGod
initially facing up on 5 ] => rotate left on 3s [ => rotate left on 2s \ => rotate left on 4s Y => rotate left U => rotate right on 3s S => rotate right on 2s R => rotate right on 4s Q => rotate right M => move on 3s K => move on 2s J => move on 4s I => move GOAL on 6
and these additional instructions e => reset if on 3s c => reset if on 2s b => reset if on 4s a => reset
12:34
we start where the 5 is, but it's replaced with a 2 and we start facing up (edited)
Avatar
so I I Q I Q Q a would land us on 4, then reset, then we'd land on the 3 and face down
12:37
but this only uses unconditional instructions, so i need to make some adjustments
12:42
dunno what i did wrong with IIQIRR[a
Avatar
oops reversed direction of rotations, so should be IIYIRRSa but thats not working either
12:50
oh wait, that works lmao
12:51
wait no it only does in the debugger
12:51
because im dumb lmao
12:52
CyberErudites{IIYIRRSa}
Avatar
Avatar
TheBadGod
used /ctf solve
✅ Challenge solved.
Avatar
wait im still a bit confused, isnt IIY going to land on 2? 5->2->2->turn left
Avatar
i had to rotate left/right reversed (edited)
Avatar
ah ok
13:04
oh i see
Avatar
Avatar
TheBadGod
start at 5, goal is at 6, need to figure out how to encode the sol ##############6 ##############2 ########2322#22 2322####2##222# 2##222##3####4# 3####3##224#### 224##2###2##### #2##422#22##### #5####222###### ########4######
rip I didn't even get to this step, what's the overall structure of the function calls....? From my understanding, main() calls the checker function, and the checker function just do a bunch of array manipulations...
Exported 39 message(s)